﻿#ifndef NP_EXPORT_H
#define NP_EXPORT_H

#include "common.h"

typedef struct  nport_push_client__t_*  nport_push_client__t ;

#ifdef _WIN32
void  lib_load(void);
void  lib_unload(void) ;
#else // _WIN32
void __attribute__ ((constructor)) lib_load(void);
void __attribute__ ((destructor)) lib_unload(void) ;
#endif // !_WIN32

// 创建实例
MVAPI(nport_push_client__t) np_create(const char* id, const char* host, const int32_t port_receiver, const int32_t port_sender, const uint8_t priority);
// 绑定本机ip地址，本机多ip地址时可绑定
MVAPI(void) np_bind_local_ip(nport_push_client__t inst, const char* ip_addr);
// 开始通信
MVAPI(bool) np_start(nport_push_client__t inst, mv::status_callback status_callback, mv::message_callback msg_callback);
// 是否在运行中
MVAPI(mv::run_status) np_run_status(nport_push_client__t inst);
// 获取连接状态
MVAPI(mv::connect_status) np_connect_status(nport_push_client__t inst);
// 是否已建立连接
MVAPI(mv::connect_status) np_check_connect_status(nport_push_client__t inst, mv::connect_status desired_status, int32_t milliseconds_timeout);
// 发送消息
MVAPI(bool) np_send_msg(const char* id, uint8_t* msg, int32_t length);
// 停止通信
MVAPI(void) np_stop(nport_push_client__t inst);
// 销毁实例
MVAPI(void) np_destroy(nport_push_client__t inst);

#endif // NP_EXPORT_H
